function van2x

global lam

figure(1)
clf
% get(gcf)
set(gcf,'Position', [25 1028 560 309])
co = [0 0 1;
    0 0.5 0;
    1 0 0;
    0 0.75 0.75;
    0.75 0 0.75;
    0.75 0.75 0;
    0.25 0.25 0.25];
set(groot,'defaultAxesColorOrder',co)
subaxis(1,2,1,1,'MT',0.01,'MB',0.2,'MR',0.01,'ML',0.055,'P',0.04)
%h=subaxis(rows,cols,cellx,celly[,settings])
lam=20;
ep=1/lam

hold on
%axis equal
nx=100; ym=3;
ys=linspace(-ym,ym,nx);
for i=1:nx
    vs(i)=(ys(i)-ys(i)^3/3);
end
plot(ys,vs,'r','LineWidth',1)
axis([-2.05 -1.95 2/3-0.05 2/3+0.05])

t1=1.5-log(2);
tmax=2*t1+0.3;
y10=2+(2/9)*ep^2; y20=-2/3;
y0=[y10 y20];
% calculate solution using a MATLAB routine
options = odeset('RelTol', 1e-6,'AbsTol',1e-6);
[t2,y2] = ode23s(@rhs,[0 tmax],y0,options);
zz=-2/3;
%axis([1.99 2.01 zz-0.001 zz+0.01])
plot(2+ep^2*(2/9),zz,'rx','MarkerSize',20)
plot(-2-ep^2*(2/9),-zz,'rx','MarkerSize',20)
hold on

plot(y2(:,1),y2(:,2),'b','LineWidth',1)

length(t2)
xticks([-2 -1 0 1 2])
%xticklabels({'-2/3','0','2/3'})
yticks([-2/3 0 2/3])
yticklabels({'-2/3','0','2/3'})
xlabel('y-axis','FontWeight','bold')
ylabel('u-axis','FontWeight','bold')
grid on

j=0;
fot i=1:length(t2)
if y2(i,1)>-2-0.05 && y2(i,1)<-2+0.05
    if y2(i,2)>2/3 && y2(i,2)<2/3+0.05
        j=j+1;
        



box on
set(gca,'FontSize',12,'FontWeight','bold')
hold off



subaxis(1,2,2,1)
%h=subaxis(rows,cols,cellx,celly[,settings])
lam=20;
ep=1/lam;

hold on

plot(ys,vs,'r','LineWidth',1)
axis([1.95 2.05 -2/3-0.05 -2/3+0.05])

plot(2+ep^2*(2/9),zz,'rx','MarkerSize',20)
plot(-2-ep^2*(2/9),-zz,'rx','MarkerSize',20)
hold on

plot(y2(:,1),y2(:,2),'b','LineWidth',1)

length(t2)
xticks([-2 -1 0 1 2])
%xticklabels({'-2/3','0','2/3'})
yticks([-2/3 0 2/3])
yticklabels({'-2/3','0','2/3'})
xlabel('y-axis','FontWeight','bold')
ylabel('u-axis','FontWeight','bold')
grid on







box on
set(gca,'FontSize',12,'FontWeight','bold')
hold off



return

figure(2)
clf
% get(gcf)
set(gcf,'Position', [26 695 563 249])
co = [0 0 1;
    0 0.5 0;
    1 0 0;
    0 0.75 0.75;
    0.75 0 0.75;
    0.75 0.75 0;
    0.25 0.25 0.25];
set(groot,'defaultAxesColorOrder',co)
subaxis(1,1,1,1,'MT',0.01,'MB',0.2,'MR',0.01,'ML',0.05,'P',0.04)

hold on
plot(t2,y2(:,1),'b','LineWidth',1.5)
%plot(tl,yl(:,2),'r')
axis([0 6 -2.1 2.1])
xlabel('\tau-axis','FontWeight','bold')
ylabel('y-axis','FontWeight','bold')
grid on
text(4.1,0,'B','FontSize',12,'FontWeight','bold')
text(4.6,-1.8,'C','FontSize',12,'FontWeight','bold')
text(4.95,0,'D','FontSize',12,'FontWeight','bold')
text(3.7,1.8,'A','FontSize',12,'FontWeight','bold')
set(gca,'FontSize',12,'FontWeight','bold')

%exportgraphics(gcf,'/Users/mark/Desktop/van2.pdf')

figure(3)
clf
% get(gcf)
set(gcf,'Position', [24 380 563 249])
co = [0 0 1;
    0 0.5 0;
    1 0 0;
    0 0.75 0.75;
    0.75 0 0.75;
    0.75 0.75 0;
    0.25 0.25 0.25];
set(groot,'defaultAxesColorOrder',co)
subaxis(1,1,1,1,'MT',0.01,'MB',0.2,'MR',0.01,'ML',0.05,'P',0.04)

hold on
plot(t2,y2(:,2),'b','LineWidth',1.5)
y2(1,2)
y2(2,2)
axis([0 6 -1 1])
xlabel('\tau-axis','FontWeight','bold')
ylabel('u-axis','FontWeight','bold')
grid on
set(gca,'FontSize',12)


%  define f(t,y)
function dy=rhs(t,y)
global lam
dy=zeros(2,1);
dy(1) = lam^2*(y(1)*(1-y(1)^2/3)-y(2));
dy(2) = y(1);

% function z=dY(y,u)
% global lam
% z = lam^2*(y*(1-y^2/3)-u);
% 
% function z=dU(y,u)
% global lam
% z = y;






